class Stack {
  constructor(...args) {
    this.stack = [...args];
  }
  push(...items) {
    return this.stack.push(...items);
  }
  pop(...items) {
    return this.stack.pop();
  }
  size() {
    return this.stack.length;
  }
  isEmpty() {
    return this.size() === 0;
  }
  peek() {
    return this.isEmpty() ? undefined : this.stack[this.size() - 1];
  }
}

class Queue {
  constructor(...args) {
    this.queue = [...args];
  }
  enqueue(...items) {
    return this.queue.push(...items);
  }
  dequeue() {
    return this.queue.shift();
  }
  size() {
    return this.queue.length;
  }
  isEmpty() {
    return this.size === 0;
  }
  front() {
    return this.isEmpty() ? undefined : this.queue[0];
  }
  back() {
    return this.isEmpty() ? undefined : this.queue[this.size() - 1];
  }
}
